/* 实训任务四 - 数据表格样式 */

/* 基础重置 */
* {
    box-sizing: border-box;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .container {
        padding: 10px !important;
        margin: 10px !important;
    }

    .filter-row {
        flex-direction: column !important;
        align-items: stretch !important;
    }
    
    .filter-row > * {
        margin-bottom: 5px;
    }
    
    .info-bar {
        flex-direction: column !important;
        gap: 10px;
    }
    
    .table-container {
        font-size: 12px;
    }
    
    .data-table th, .data-table td {
        padding: 8px !important;
    }
    
    .pagination-container {
        flex-direction: column;
        gap: 15px;
    }

    .pagination {
        flex-wrap: wrap;
    }

    .page-jump {
        width: 100%;
        justify-content: center;
    }
}

/* 动画效果 */
.data-table tbody tr {
    transition: background-color 0.2s ease;
}

.btn {
    transition: all 0.2s ease;
}

.btn:active {
    transform: translateY(1px);
}

/* 加载动画 */
.loading {
    position: relative;
}

.loading::after {
    content: '';
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: translateY(-50%) rotate(0deg); }
    100% { transform: translateY(-50%) rotate(360deg); }
}



.data-table th {
    border-color: #007bff;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.data-table td {
    border-bottom: 1px solid #e9ecef;
}

.data-table tr:last-child td {
    border-bottom: none;
}

/* 排序指示器增强 */
.data-table th.sortable {
    position: relative;
    padding-right: 25px;
}


/* 过滤器样式增强 */
.filter-section {
    border: 1px solid #e9ecef;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.filter-row select:focus, .filter-row input:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 2px rgba(0,123,255,0.25);
}

/* 按钮样式增强 */
.btn {
    border: 1px solid transparent;
    font-weight: 500;
    text-decoration: none;
    display: inline-block;
    text-align: center;
    vertical-align: middle;
    user-select: none;
}

.btn-primary {
    border-color: #007bff;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.btn-primary:hover {
    background-color: #0056b3;
    border-color: #004085;
}

.btn-success {
    background-color: #28a745;
    color: white;
    border-color: #28a745;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.btn-success:hover {
    background-color: #218838;
    border-color: #1e7e34;
}

.btn-secondary {
    border-color: #6c757d;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.btn-secondary:hover {
    background-color: #545b62;
    border-color: #4e555b;
}

/* 分页容器 */
.pagination-wrapper {
    display: flex !important;
    justify-content: center;
    align-items: center;
    gap: 30px;
    margin: 20px 0;
    flex-wrap: wrap;
}

.pagination-container {
    display: flex !important;
    justify-content: center;
    align-items: center;
    gap: 30px;
    margin: 20px 0;
    flex-wrap: wrap;
}

/* 页面跳转容器 */
.page-jump-wrapper {
    display: flex !important;
    justify-content: center;
    align-items: center;
    margin: 20px 0;
}

/* 分页样式增强 */
.pagination {
    display: flex !important;
    justify-content: center;
    align-items: center;
    gap: 10px;
    background-color: #f8f9fa;
    padding: 15px;
    border-radius: 5px;
    border: 1px solid #e9ecef;
    flex-shrink: 0;
}

.pagination button {
    min-width: 40px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.pagination button.current-page {
    box-shadow: 0 2px 4px rgba(0,123,255,0.3);
}

.pagination .page-info {
    font-weight: 500;
    color: #495057;
    margin: 0 10px;
}

/* 信息栏样式 */
.info-bar {
    display: flex !important;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
    padding: 15px;
    border: 1px solid #e9ecef;
    font-size: 14px;
    font-weight: 500;
    background-color: #f8f9fa;
    border-radius: 4px;
    flex-wrap: wrap;
}

/* 错误信息样式 */
.error {
    border: 1px solid #f5c6cb;
    font-weight: 500;
}

/* 成功信息样式 */
.success {
    color: #155724;
    background-color: #d4edda;
    border: 1px solid #c3e6cb;
    padding: 10px;
    border-radius: 3px;
    margin: 10px 0;
    font-weight: 500;
}

/* 多重过滤器样式 */
.multiple-filter-item {
    background-color: white;
    border: 1px solid #ddd;
    border-radius: 3px;
    padding: 10px;
    margin-bottom: 10px;
    position: relative;
}

.multiple-filter-item .remove-filter {
    position: absolute;
    top: 5px;
    right: 5px;
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.multiple-filter-item .remove-filter:hover {
    background: #c82333;
}

/* 表格数据类型特定样式 */
.data-table .number-cell {
    text-align: right;
    font-family: 'Courier New', monospace;
}

.data-table .date-cell {
    font-family: 'Courier New', monospace;
    font-size: 13px;
}

.data-table .price-cell {
    text-align: right;
    font-weight: 500;
}


/* 空数据状态 */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #6c757d;
}

.empty-state .empty-icon {
    font-size: 48px;
    margin-bottom: 15px;
    opacity: 0.5;
}

.empty-state .empty-message {
    font-size: 16px;
    font-weight: 500;
    margin-bottom: 10px;
}

.empty-state .empty-description {
    font-size: 14px;
    opacity: 0.8;
}

/* 工具提示 */
.tooltip {
    position: relative;
    cursor: help;
}

.tooltip::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: #333;
    color: white;
    padding: 5px 8px;
    border-radius: 3px;
    font-size: 12px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    z-index: 1000;
}

.tooltip:hover::after {
    opacity: 1;
}

/* 高亮搜索结果 */
.highlight {
    background-color: #fff3cd;
    padding: 1px 2px;
    border-radius: 2px;
}

/* 导航栏样式 */
.nav-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 15px;
    background-color: #f8f9fa;
    border-radius: 5px;
    border: 1px solid #e9ecef;
}

/* 页面信息样式 */
.page-info {
    display: flex !important;
    justify-content: center;
    align-items: center;
    padding: 10px 15px;
    background-color: #f8f9fa;
    border-radius: 5px;
    border: 1px solid #e9ecef;
    font-weight: 500;
    color: #495057;
    white-space: nowrap;
    flex-shrink: 0;
}

/* 页面跳转样式 */
.page-jump {
    display: flex !important;
    justify-content: center;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background-color: #f8f9fa;
    border-radius: 5px;
    border: 1px solid #e9ecef;
    white-space: nowrap;
    flex-shrink: 0;
}

.page-jump input {
    width: 80px;
    padding: 5px 8px;
    border: 1px solid #ddd;
    border-radius: 3px;
    text-align: center;
}

/* 模态框样式 */
.modal {
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #e9ecef;
    background-color: #f8f9fa;
    border-radius: 8px 8px 0 0;
}

.modal-header h3 {
    margin: 0;
    color: #333;
}

.close {
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
    color: #666;
    line-height: 1;
}

.close:hover {
    color: #000;
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 20px;
    border-top: 1px solid #e9ecef;
    background-color: #f8f9fa;
    border-radius: 0 0 8px 8px;
}

/* 表单样式 */
.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #333;
}

.form-group input, .form-group select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.form-group input:focus, .form-group select:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 2px rgba(0,123,255,0.25);
}

/* 操作按钮样式 */
.action-buttons {
    display: flex !important;
    gap: 5px;
    justify-content: center;
    align-items: center;
}

.btn-sm {
    padding: 4px 8px;
    font-size: 12px;
}

.btn-danger {
    background-color: #dc3545;
    color: white;
    border-color: #dc3545;
}

.btn-danger:hover {
    background-color: #c82333;
    border-color: #bd2130;
}

.btn-warning {
    background-color: #ffc107;
    color: #212529;
    border-color: #ffc107;
}

.btn-warning:hover {
    background-color: #e0a800;
    border-color: #d39e00;
}

/* 成功信息样式 */
.success {
    color: #155724;
    background-color: #d4edda;
    border: 1px solid #c3e6cb;
    padding: 10px;
    border-radius: 3px;
    margin: 10px 0;
    font-weight: 500;
}

/* 打印样式 */
@media print {
    .filter-section, .pagination-container, .pagination, .info-bar, .page-jump, .modal {
        display: none !important;
    }

    .container {
        box-shadow: none !important;
        padding: 0 !important;
    }

    .data-table {
        font-size: 12px;
    }

    .data-table th, .data-table td {
        padding: 6px !important;
    }
}
